
package com.ruoyi.web.controller.lingshui.integrityInformationAdd;


import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.ruoyi.common.config.Global;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.LSBusinessException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.supervise.domain.BaseProjectInfo;
import com.ruoyi.supervise.domain.CompanyPoorInfoEntuty;
import com.ruoyi.supervise.domain.CompanyWellInfoEntity;
import com.ruoyi.supervise.domain.Enterprise;
import com.ruoyi.supervise.domain.IGMAuditRecord;
import com.ruoyi.supervise.domain.IGMBehavioStandard;
import com.ruoyi.supervise.domain.IGMCompanyPoorInfo;
import com.ruoyi.supervise.domain.IGMCompanyWellInfo;
import com.ruoyi.supervise.domain.IGMIntegrityApplyInfo;
import com.ruoyi.supervise.domain.ProjectArchives;
import com.ruoyi.supervise.domain.StandardEntity;
import com.ruoyi.supervise.service.IEnterpriseService;
import com.ruoyi.supervise.service.IIntegrityInformationAddService;
import com.ruoyi.supervise.service.IProjectArchivesBaseInfoService;
import com.ruoyi.supervise.service.IProjectArchivesService;
import com.ruoyi.system.domain.SysUser;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;

/**
 * @ClassName: enterprisesBehaviorController
 * @Description: 诚信信息管理中企业行为的controller
 * @Author wtj
 * @DateTime 2020年5月12日 下午3:29:59
 */
@Controller
@RequestMapping("/integrityInformationAdd/enterprisesBehavior")
public class EnterprisesController extends BaseController{

	private String enterprisesGoodBehaviorPrefix = "lingshui/integrityInformationAdd/enterprisesBehavior/good";
	private String enterprisesBadBehaviorPrefix = "lingshui/integrityInformationAdd/enterprisesBehavior/bad";
	private String selectPrefix = "lingshui/integrityInformationAdd/select";
	
	@Autowired
    private IIntegrityInformationAddService integrityInformationAddService;
	
	@Autowired
    private IEnterpriseService enterpriseService;
	
	@Autowired
    private IProjectArchivesService projectArchivesService;
	
	@Autowired
    private IProjectArchivesBaseInfoService projectArchivesBaseInfoService;
	
	/**
	 * @Title: enterprisesGoodBehavior
	 * @Description: 跳转到企业良好行为登记列表页面
	 * @Author wtj
	 * @DateTime 2020年6月10日 下午6:02:57
	 * @return
	 */
	@RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:view")
	@GetMapping("/enterprisesGood")
	public String enterprisesGoodBehavior()
	{
	    return enterprisesGoodBehaviorPrefix + "/enterprisesGoodBehavior";
	}
	
	/**
	 * @Title: enterprisesGoodBehaviorList
	 * @Description: 获取企业良好行为登记列表数据
	 * @Author wtj
	 * @DateTime 2020年6月10日 下午5:54:10
	 * @param igmai
	 * @return
	 */
	@RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:list")
	@PostMapping("/enterprisesGoodBehaviorList")
    @ResponseBody
    public TableDataInfo enterprisesGoodBehaviorList(IGMIntegrityApplyInfo igmai)
    {
	   startPage();
	   List<IGMIntegrityApplyInfo> igmaiList = integrityInformationAddService.selectEnterGoodIGMIntegrityApplyInfoList(igmai);
	   return getDataTable(igmaiList);
    }
	
	/**
	 * @Title: enterprisesGoodBehaviorAdd
	 * @Description: 跳转到企业良好行为添加页面
	 * @Author wtj
	 * @DateTime 2020年6月10日 下午5:54:44
	 * @param mmap
	 * @return
	 */
	@RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:add")
	@GetMapping("/enterprisesGoodBehaviorAdd")
    public String enterprisesGoodBehaviorAdd(ModelMap mmap)
    {
		SysUser currentUser = ShiroUtils.getSysUser();
		mmap.put("RegPerson", currentUser.getUserName());
		mmap.put("OwnerGuid", currentUser.getLoginName());
		mmap.put("RegDepartment", currentUser.getDept().getDeptName());
		mmap.put("RegDepartmentGuid", currentUser.getDeptId());
        return enterprisesGoodBehaviorPrefix + "/enterprisesGoodBehaviorAdd";
    }
	
	/**
	 * @Title: enterGoodBehavioStandard
	 * @Description: 跳转到企业良好行为选择页面
	 * @Author wtj
	 * @DateTime 2020年6月10日 下午5:55:34
	 * @param identifyType
	 * @param mmap
	 * @return
	 */
	@RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:selectview")
	@GetMapping("/enterGoodBehavioStandard/{identifyType}/{organCode}")
    public String enterGoodBehavioStandard(@PathVariable("identifyType") String identifyType,@PathVariable("organCode") String organCode,ModelMap mmap)
    {
		List<String> strList = integrityInformationAddService.selectIGMIntegrityApplyInfoPunishObject(identifyType);
		if(!organCode.equals("0")) {
			List<String> quaList = integrityInformationAddService.selectIGMCompanyWellInfoByDateadd(organCode);
			List<String> quaListNew = CollUtil.distinct(quaList);
			List<String> list = new ArrayList<String>(CollUtil.disjunction(strList, quaListNew));
			strList = list;
		}
		mmap.put("strList", strList);
		mmap.put("title", "企业良好行为");
		mmap.put("urlPrefix", "integrityInformationAdd/enterprisesBehavior");
		return selectPrefix + "/behavioStandard";
    }
	
	/**
	 * @Title: behavioStandardList
	 * @Description: 获取行为选择页面数据
	 * @Author wtj
	 * @DateTime 2020年6月10日 下午5:56:22
	 * @param identifyType
	 * @param punishObject
	 * @param igmbs
	 * @return
	 */
	@RequiresPermissions(value={"integrityInformationAdd:enterprisesGoodBehavior:selectlist", "integrityInformationAdd:enterprisesBadBehavior:selectlist"}, logical=Logical.OR)
	@PostMapping("/behavioStandardList/{identifyType}/{punishObject}")
    @ResponseBody
    public TableDataInfo behavioStandardList(@PathVariable("identifyType") String identifyType,@PathVariable("punishObject") String punishObject,IGMBehavioStandard igmbs)
    {
	   startPage();
	   igmbs.setIdentifyType(identifyType);
	   igmbs.setPunishObject(punishObject);
	   List<IGMBehavioStandard> igmbsList = integrityInformationAddService.selectIGMBehavioStandardList(igmbs);
	   return getDataTable(igmbsList);
    }
	
	/**
	 * @Title: selectEnterTable
	 * @Description: 跳转到企业选择页面
	 * @Author wtj
	 * @DateTime 2020年6月10日 下午5:56:51
	 * @return
	 */
	@RequiresPermissions("enterprise:enterpriseAll:view")
	@GetMapping("/selectEnterTable")
    public String selectEnterTable()
    {
		return selectPrefix + "/selectEnterTable";
    }
	
	/**
	 * @Title: selectEnterTableList
	 * @Description: 获取企业选择页面数据
	 * @Author wtj
	 * @DateTime 2020年6月10日 下午5:57:59
	 * @param enter
	 * @return
	 */
	@RequiresPermissions("enterprise:enterpriseAll:list")
	@PostMapping("/selectEnterTableList")
    @ResponseBody
    public TableDataInfo selectEnterTableList(Enterprise enter)
    {
		startPage();
		List<Enterprise> enterList = integrityInformationAddService.enterTableList(enter);
		return getDataTable(enterList);
    }
	
	/**
	 * @Title: selectProjectTable
	 * @Description: 跳转到项目选择页面
	 * @Author wtj
	 * @DateTime 2020年6月10日 下午5:58:16
	 * @return
	 */
	@RequiresPermissions("project:projectAll:view")
	@GetMapping("/selectProjectTable")
    public String selectProjectTable()
    {
		return selectPrefix + "/selectProjectTable";
    }
	
	/**
	 * @Title: selectProjectTableList
	 * @Description: 获取项目选择页面的数据
	 * @Author wtj
	 * @DateTime 2020年6月10日 下午5:58:29
	 * @param projectArchives
	 * @return
	 */
	@RequiresPermissions("project:projectAll:lists")
	@PostMapping("/selectProjectTableList")
    @ResponseBody
    public TableDataInfo selectProjectTableList(ProjectArchives projectArchives)
    {
		startPage();
		List<ProjectArchives> projectArchivesList = projectArchivesService.selectProjectArchivesList(projectArchives);
		return getDataTable(projectArchivesList);
    }
	
	/**
	 * @Title: addEnterBehavioField
	 * @Description: 选择好企业行为的接口
	 * @Author wtj
	 * @DateTime 2020年6月10日 下午5:58:46
	 * @param behaviorCode
	 * @param companyGuid
	 * @param organCode
	 * @param goodOrBad
	 * @return
	 */
	@RequiresPermissions(value={"integrityInformationAdd:enterprisesGoodBehavior:selectlist", "integrityInformationAdd:enterprisesBadBehavior:selectlist"}, logical=Logical.OR)
    @PostMapping("/addEnterBehavioField")
    @ResponseBody
    public AjaxResult addEnterBehavioField(@RequestParam("behaviorCode") String behaviorCode,@RequestParam("companyGuid") String companyGuid,@RequestParam("organCode") String organCode,@RequestParam("goodOrBad") String goodOrBad)
    {
    	Map<String,Object> strMap = new HashMap<String,Object>();
    	IGMBehavioStandard igmbs = integrityInformationAddService.selectIGMBehavioStandardByGuid(behaviorCode);
    	strMap.put("BehaviorCode", igmbs.getGuid());
    	strMap.put("BehaviorCategory", igmbs.getBehaviorCategory());
    	strMap.put("BehaviorDescription", igmbs.getBehavioDescription());
    	strMap.put("MaxScores", igmbs.getMaxScores());
    	if(StrUtil.containsAny(igmbs.getPenaltyScores(), ",")) {
    		String[] scoreList=StrUtil.split(igmbs.getPenaltyScores(), ",");
    		strMap.put("Score", scoreList);
    	}else {
    		strMap.put("Score", igmbs.getPenaltyScores());
    	}
    	if(!StringUtils.isEmpty(companyGuid)) {
    		String pointsAdded = "0";
    		if("good".equals(goodOrBad)) {
    			IGMCompanyWellInfo igmcwi = new IGMCompanyWellInfo();
        		igmcwi.setCompanyGuid(companyGuid);
        		igmcwi.setBehaviorCode(behaviorCode);
        		igmcwi.setOrganCode(organCode);
            	igmcwi.setLNPublishEndDate(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MS_PATTERN));
            	pointsAdded = integrityInformationAddService.sumEnterGoodAddedScores(igmcwi);
    		}else if("bad".equals(goodOrBad)) {
    			IGMCompanyPoorInfo igmcpi = new IGMCompanyPoorInfo();
    			igmcpi.setCompanyGuid(companyGuid);
    			igmcpi.setBehaviorCode(behaviorCode);
    			igmcpi.setOrganCode(organCode);
    			igmcpi.setPublishEndDate(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MS_PATTERN));
    			pointsAdded = integrityInformationAddService.sumEnterBadAddedScores(igmcpi);
    		}
    		if(StringUtils.isEmpty(pointsAdded)) {
    			pointsAdded = "0";
    		}
        	strMap.put("pointsAdded", pointsAdded);
    	}else {
    		strMap.put("pointsAdded", " ");
    	}
    	return AjaxResult.success(strMap);
    }
    
    /**
     * @Title: addEnterField
     * @Description: 选择好企业的接口
     * @Author wtj
     * @DateTime 2020年6月10日 下午5:59:26
     * @param behaviorCode
     * @param companyGuid
     * @return
     */
	@RequiresPermissions("enterprise:enterpriseAll:list")
    @PostMapping("/addEnterField")
    @ResponseBody
    public AjaxResult addEnterField(@RequestParam("behaviorCode") String behaviorCode,@RequestParam("companyGuid") String companyGuid,@RequestParam("organCode") String organCode,@RequestParam("goodOrBad") String goodOrBad)
    {
    	Map<String,Object> strMap = new HashMap<String,Object>();
    	Enterprise enter = enterpriseService.selectEnterpriseInfoByGuid(companyGuid);
    	strMap.put("CompanyName", enter.getCompanyName());
    	strMap.put("OrganCode", enter.getOrganCode());
    	strMap.put("CompanyGuid", enter.getGuid());
    	if(!StringUtils.isEmpty(behaviorCode)) {
    		IGMBehavioStandard igmbs = integrityInformationAddService.selectIGMBehavioStandardByGuid(behaviorCode);
    		String pointsAdded = " ";
    		boolean isUndo = false;
    		if("good".equals(goodOrBad)) {
    			IGMCompanyWellInfo igmcwi = new IGMCompanyWellInfo();
        		igmcwi.setCompanyGuid(companyGuid);
        		igmcwi.setBehaviorCode(behaviorCode);
        		igmcwi.setOrganCode(organCode);
            	igmcwi.setLNPublishEndDate(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MS_PATTERN));
            	pointsAdded = integrityInformationAddService.sumEnterGoodAddedScores(igmcwi);
            	isUndo = integrityInformationAddService.judgeQualificationsUndo(organCode, igmbs.getPunishObject());
    		}else if("bad".equals(goodOrBad)) {
    			IGMCompanyPoorInfo igmcpi = new IGMCompanyPoorInfo();
    			igmcpi.setCompanyGuid(companyGuid);
    			igmcpi.setBehaviorCode(behaviorCode);
    			igmcpi.setOrganCode(organCode);
    			igmcpi.setPublishEndDate(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MS_PATTERN));
    			pointsAdded = integrityInformationAddService.sumEnterBadAddedScores(igmcpi);
    			isUndo = integrityInformationAddService.judgeQualificationsUndoPoor(organCode, igmbs.getPunishObject());
    		}
    		if(StringUtils.isEmpty(pointsAdded)) {
    			pointsAdded = "0";
    		}
        	strMap.put("pointsAdded", pointsAdded);
        	strMap.put("isUndo", isUndo);
    	}else {
    		strMap.put("pointsAdded", " ");
    	}
    	return AjaxResult.success(strMap);
    }
    
    /**
     * @Title: addProjectField
     * @Description: 选择好项目的接口
     * @Author wtj
     * @DateTime 2020年6月10日 下午5:59:41
     * @param projectGuid
     * @return
     */
	@RequiresPermissions("project:projectAll:lists")
    @PostMapping("/addProjectField")
    @ResponseBody
    public AjaxResult addProjectField(@RequestParam("projectGuid") String projectGuid)
    {
    	BaseProjectInfo projectArchivesBaseInfo = new BaseProjectInfo();
    	projectArchivesBaseInfo.setGuid(projectGuid);
 	    BaseProjectInfo pabi=projectArchivesBaseInfoService.selectProjectArchivesBaseInfoByGuid(projectArchivesBaseInfo);
    	Map<String,Object> strMap = new HashMap<String,Object>();
    	strMap.put("EngineeringGuid", pabi.getGuid());
    	strMap.put("EngineeringName", pabi.getProjectName());
    	return AjaxResult.success(strMap);
    }
    
    /**
     * @Title: enterprisesGoodBehaviorSaveAndReport
     * @Description: 企业良好行为添加保存接口(该接口没有文件上传)
     * @Author wtj
     * @DateTime 2020年6月10日 下午5:59:59
     * @param cwie
     * @return
     */
	@RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:add")
    @PostMapping("/enterprisesGoodBehaviorSaveAndReport")
    @ResponseBody
    public AjaxResult enterprisesGoodBehaviorSaveAndReport(@Validated CompanyWellInfoEntity cwie,String MaxScores)
    {
    	return toAjax(integrityInformationAddService.enterprisesGoodBehaviorSaveAndReport(cwie,MaxScores));
    }
    
    /**
     * @Title: addFileInsertGood
     * @Description: 企业良好行为添加保存接口(该接口有文件上传)
     * @Author wtj
     * @DateTime 2020年6月10日 下午6:00:36
     * @param addFile
     * @param cwie
     * @return
     * @throws IOException
     */
	@RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:add")
    @PostMapping("/addFileInsertGood")
    @ResponseBody
    public AjaxResult addFileInsertGood(@RequestParam("addFileInsertGood") MultipartFile addFile,CompanyWellInfoEntity cwie,String MaxScores) throws IOException
    {
    	// 上传文件路径
    	String filePath = Global.getLSUploadPath();
    	//String filePath = Global.getUploadPath();
    	//String filePath = Global.getProfile();
    	// 上传并返回新文件名称
		String fileName = FileUploadUtils.upload(filePath, addFile);
		//cwie.setMaterials(fileName);
		cwie.setMaterials("|"+fileName+"|"+"企业良好行为记录相关材料_"+cwie.getCompanyName()+"_"+cwie.getBehaviorCode()+"."+FileUploadUtils.getExtension(addFile)+"|"+addFile.getSize());
		//cwie.setFileNameOld(addFile.getOriginalFilename());
		cwie.setFileNameOld("企业良好行为记录相关材料_"+cwie.getCompanyName()+"_"+cwie.getBehaviorCode()+"."+FileUploadUtils.getExtension(addFile));
		int i = integrityInformationAddService.enterprisesGoodBehaviorSaveAndReport(cwie,MaxScores);
    	return AjaxResult.success(i);
    }
    
    /**
     * @Title: editEnterGoodBehavior
     * @Description: 跳转到企业良好行为登记编辑页面接口
     * @Author wtj
     * @DateTime 2020年6月10日 下午6:00:54
     * @param guid
     * @param mmap
     * @return
     */
	@RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:wsbeditxw")
    @GetMapping("/editEnterGoodBehavior/{guid}")
    public String editEnterGoodBehavior(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyWellInfoEntity().getBehaviorCode());
    	applyInfo.getCompanyWellInfoEntity().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyWellInfoEntity", applyInfo.getCompanyWellInfoEntity());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	if(StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[2]);
    		String filePath = StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesGoodBehaviorPrefix + "/enterprisesGoodBehaviorUpdate";
    }
    
    /**
     * @Title: enterprisesGoodBehaviorSaveAndReportUpdate
     * @Description: 企业良好行为编辑保存接口(该接口不包含文件上传)
     * @Author wtj
     * @DateTime 2020年6月10日 下午6:01:31
     * @param cwie
     * @return
     */
	@RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:wsbeditxw")
    @PostMapping("/enterprisesGoodBehaviorSaveAndReportUpdate")
    @ResponseBody
    public AjaxResult enterprisesGoodBehaviorSaveAndReportUpdate(@Validated CompanyWellInfoEntity cwie,String MaxScores)
    {
    	return toAjax(integrityInformationAddService.updateEnterprisesGoodBehavior(cwie,1,MaxScores));
    }
    
    /**
     * @Title: addFileGoodUpdate
     * @Description: 企业良好行为编辑保存接口(该接口包含文件上传)
     * @Author wtj
     * @DateTime 2020年6月10日 下午6:01:58
     * @param addFile
     * @param cwie
     * @return
     * @throws IOException
     */
	@RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:wsbeditxw")
    @PostMapping("/addFileGoodUpdate")
    @ResponseBody
    public AjaxResult addFileGoodUpdate(@RequestParam("addFileGoodUpdate") MultipartFile addFile,CompanyWellInfoEntity cwie,String MaxScores) throws IOException
    {
    	// 上传文件路径
    	String filePath = Global.getLSUploadPath();
    	//String filePath = Global.getUploadPath();
    	//String filePath = Global.getProfile();
    	// 上传并返回新文件名称
		String fileName = FileUploadUtils.upload(filePath, addFile);
		//cwie.setMaterials(fileName);
		cwie.setMaterials("|"+fileName+"|"+"企业良好行为记录相关材料_"+cwie.getCompanyName()+"_"+cwie.getBehaviorCode()+"."+FileUploadUtils.getExtension(addFile)+"|"+addFile.getSize());
		//cwie.setFileNameOld(addFile.getOriginalFilename());
		cwie.setFileNameOld("企业良好行为记录相关材料_"+cwie.getCompanyName()+"_"+cwie.getBehaviorCode()+"."+FileUploadUtils.getExtension(addFile));
		int i = integrityInformationAddService.updateEnterprisesGoodBehavior(cwie,0,MaxScores);
    	return AjaxResult.success(i);
    }
    
    /**
     * @Title: resourceDownload
     * @Description: 文件下载
     * @Author wtj
     * @DateTime 2020年6月11日 上午9:51:33
     * @param resource 数据库中的文件路径
     * @param fileName 文件名称
     * @param request
     * @param response
     * @throws Exception
     */
    @GetMapping("/download")
    public void resourceDownload(String resource,String fileName, HttpServletRequest request, HttpServletResponse response)
            throws Exception
    {
        // 本地资源路径
        //String localPath = Global.getProfile();
    	String localPath = Global.getUploadPath();
        // 数据库资源地址
        String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
        // 下载名称
        String downloadName = fileName;
        response.setCharacterEncoding("utf-8");
        response.setContentType("multipart/form-data");
        response.setHeader("Content-Disposition",
                "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
        FileUtils.writeBytes(downloadPath, response.getOutputStream());
    }
    
    /**
     * @Title: enterprisesBadBehavior
     * @Description: 跳转到企业不良行为登记列表
     * @Author wtj
     * @DateTime 2020年6月11日 上午11:40:27
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:view")
	@GetMapping("/enterprisesBad")
	public String enterprisesBadBehavior()
	{
	    return enterprisesBadBehaviorPrefix + "/enterprisesBadBehavior";
	}
    
    /**
     * @Title: enterprisesBadBehaviorList
     * @Description: 获取企业不良行为登记列表数据
     * @Author wtj
     * @DateTime 2020年6月11日 上午11:40:44
     * @param igmai
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:list")
    @PostMapping("/enterprisesBadBehaviorList")
    @ResponseBody
    public TableDataInfo enterprisesBadBehaviorList(IGMIntegrityApplyInfo igmai)
    {
    	startPage();
    	List<IGMIntegrityApplyInfo> igmaiList = integrityInformationAddService.selectEnterBadIGMIntegrityApplyInfoList(igmai);
    	return getDataTable(igmaiList);
    }
    
    /**
     * @Title: enterprisesBadBehaviorAdd
     * @Description: 跳转到企业不良行为添加
     * @Author wtj
     * @DateTime 2020年6月11日 上午11:41:01
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:add")
    @GetMapping("/enterprisesBadBehaviorAdd")
    public String enterprisesBadBehaviorAdd(ModelMap mmap)
    {
		SysUser currentUser = ShiroUtils.getSysUser();
		mmap.put("RegisterName", currentUser.getUserName());
		mmap.put("LoginId", currentUser.getLoginName());
		mmap.put("RegisterDept", currentUser.getDept().getDeptName());
		mmap.put("RegisterDeptGuid", currentUser.getDeptId());
        return enterprisesBadBehaviorPrefix + "/enterprisesBadBehaviorAdd";
    }
    
    /**
     * @Title: enterBadBehavioStandard
     * @Description: 跳转到企业不良行为选择页面
     * @Author wtj
     * @DateTime 2020年6月11日 下午2:09:01
     * @param identifyType
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:selectview")
    @GetMapping("/enterBadBehavioStandard/{identifyType}/{organCode}")
    public String enterBadBehavioStandard(@PathVariable("identifyType") String identifyType,@PathVariable("organCode") String organCode,ModelMap mmap)
    {
		List<String> strList = integrityInformationAddService.selectIGMIntegrityApplyInfoPunishObject(identifyType);
		if(!organCode.equals("0")) {
			List<String> quaList = integrityInformationAddService.selectIGMCompanyPoorInfoByDateadd(organCode);
			List<String> quaListNew = CollUtil.distinct(quaList);
			List<String> list = new ArrayList<String>(CollUtil.disjunction(strList, quaListNew));
			strList = list;
		}
		mmap.put("strList", strList);
		mmap.put("title", "企业不良行为");
		mmap.put("urlPrefix", "integrityInformationAdd/enterprisesBehavior");
		return selectPrefix + "/behavioStandard";
    }
    
    /**
     * @Title: enterprisesBadBehaviorSaveAndReport
     * @Description: 企业不良行为添加保存接口
     * @Author wtj
     * @DateTime 2020年6月11日 下午6:09:06
     * @param cpie
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:add")
    @PostMapping("/enterprisesBadBehaviorSaveAndReport")
    @ResponseBody
    public AjaxResult enterprisesBadBehaviorSaveAndReport(@Validated CompanyPoorInfoEntuty cpie,String MaxScores)
    {
    	return toAjax(integrityInformationAddService.enterprisesBadBehaviorSaveAndReport(cpie,MaxScores));
    }
    
    /**
     * @Title: addFileInsertBad
     * @Description: 企业不良行为添加保存接口(该接口有文件上传)
     * @Author wtj
     * @DateTime 2020年6月11日 下午6:08:51
     * @param addFile
     * @param cpie
     * @return
     * @throws IOException
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:add")
    @PostMapping("/addFileInsertBad")
    @ResponseBody
    public AjaxResult addFileInsertBad(@RequestParam("addFileInsertBad") MultipartFile addFile,CompanyPoorInfoEntuty cpie,String MaxScores) throws IOException
    {
    	// 上传文件路径
    	String filePath = Global.getLSUploadPath();
    	// 上传并返回新文件名称
    	String fileName = FileUploadUtils.upload(filePath, addFile);
    	cpie.setMaterials("|"+fileName+"|"+"企业不良行为记录相关材料_"+cpie.getCompanyName()+"_"+cpie.getBehaviorCode()+"."+FileUploadUtils.getExtension(addFile)+"|"+addFile.getSize());
    	cpie.setFileNameOld("企业不良行为记录相关材料_"+cpie.getCompanyName()+"_"+cpie.getBehaviorCode()+"."+FileUploadUtils.getExtension(addFile));
    	return AjaxResult.success(integrityInformationAddService.enterprisesBadBehaviorSaveAndReport(cpie,MaxScores));
    }
    
    /**
     * @Title: editEnterBadBehavior
     * @Description: 跳转到企业不良行为登记编辑页面接口
     * @Author wtj
     * @DateTime 2020年6月19日 上午9:02:49
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:wsbeditxw")
    @GetMapping("/editEnterBadBehavior/{guid}")
    public String editEnterBadBehavior(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyPoorInfoEntuty().getBehaviorCode());
    	applyInfo.getCompanyPoorInfoEntuty().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyPoorInfoEntuty", applyInfo.getCompanyPoorInfoEntuty());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	if(StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[2]);
        	String filePath = StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
    	
		return enterprisesBadBehaviorPrefix + "/enterprisesBadBehaviorUpdate";
    }
    
    /**
     * @Title: enterprisesBadBehaviorSaveAndReportUpdate
     * @Description: 企业不良行为编辑保存接口(该接口不包含文件上传)
     * @Author wtj
     * @DateTime 2020年6月12日 下午2:32:49
     * @param cpie
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:wsbeditxw")
    @PostMapping("/enterprisesBadBehaviorSaveAndReportUpdate")
    @ResponseBody
    public AjaxResult enterprisesBadBehaviorSaveAndReportUpdate(@Validated CompanyPoorInfoEntuty cpie,String MaxScores)
    {
    	return toAjax(integrityInformationAddService.updateEnterprisesBadBehavior(cpie, 1,MaxScores));
    }
    
    /**
     * @Title: addFileGoodUpdate
     * @Description: 企业不良行为编辑保存接口(该接口包含文件上传)
     * @Author wtj
     * @DateTime 2020年6月12日 下午2:49:45
     * @param addFile
     * @param cwie
     * @return
     * @throws IOException
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:wsbeditxw")
    @PostMapping("/addFileBadUpdate")
    @ResponseBody
    public AjaxResult addFileBadUpdate(@RequestParam("addFileBadUpdate") MultipartFile addFile,CompanyPoorInfoEntuty cpie,String MaxScores) throws IOException
    {
    	// 上传文件路径
    	String filePath = Global.getLSUploadPath();
    	//String filePath = Global.getUploadPath();
    	//String filePath = Global.getProfile();
    	// 上传并返回新文件名称
		String fileName = FileUploadUtils.upload(filePath, addFile);
		//cwie.setMaterials(fileName);
		cpie.setMaterials("|"+fileName+"|"+"企业不良行为记录相关材料_"+cpie.getCompanyName()+"_"+cpie.getBehaviorCode()+"."+FileUploadUtils.getExtension(addFile)+"|"+addFile.getSize());
    	cpie.setFileNameOld("企业不良行为记录相关材料_"+cpie.getCompanyName()+"_"+cpie.getBehaviorCode()+"."+FileUploadUtils.getExtension(addFile));
    	return AjaxResult.success(integrityInformationAddService.updateEnterprisesBadBehavior(cpie, 0,MaxScores));
    }
    
    //下面是审批功能
    
    /**
     * @Title: enterprisesGoodBehaviorApprove
     * @Description: 跳转到企业良好行为审批页面
     * @Author wtj
     * @DateTime 2020年6月19日 上午9:33:59
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:ysbapprovalxw")
    @GetMapping("/enterprisesGoodBehaviorApprove/{guid}")
    public String enterprisesGoodBehaviorApprove(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyWellInfoEntity().getBehaviorCode());
    	applyInfo.getCompanyWellInfoEntity().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyWellInfoEntity", applyInfo.getCompanyWellInfoEntity());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	IGMAuditRecord igmar = integrityInformationAddService.selectIGMAuditRecordByGuidTopOne(applyInfo.getGuid());
    	mmap.put("igmar", igmar);
    	if(StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[2]);
    		String filePath = StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesGoodBehaviorPrefix + "/enterprisesGoodBehaviorApprove";
    }
    
    /**
     * @Title: enterprisesGoodBehaviorApprove
     * @Description: 企业良好行为审批接口
     * @Author wtj
     * @DateTime 2020年6月19日 下午3:37:06
     * @param cwie
     * @param reasonContent
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:ysbapprovalxw")
    @PostMapping("/enterprisesGoodBehaviorApprove")
    @ResponseBody
    public AjaxResult enterprisesGoodBehaviorApprove(@Validated CompanyWellInfoEntity cwie,String reasonContent)
    {
    	return toAjax(integrityInformationAddService.enterprisesGoodBehaviorApprove(cwie,reasonContent));
    }
    
    /**
     * @Title: enterprisesBadBehaviorApprove
     * @Description: 跳转到企业不良行为审批页面
     * @Author wtj
     * @DateTime 2020年6月19日 下午6:05:54
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:ysbapprovalxw")
    @GetMapping("/enterprisesBadBehaviorApprove/{guid}")
    public String enterprisesBadBehaviorApprove(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyPoorInfoEntuty().getBehaviorCode());
    	applyInfo.getCompanyPoorInfoEntuty().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyPoorInfoEntuty", applyInfo.getCompanyPoorInfoEntuty());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	IGMAuditRecord igmar = integrityInformationAddService.selectIGMAuditRecordByGuidTopOne(applyInfo.getGuid());
    	mmap.put("igmar", igmar);
    	if(StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[2]);
        	String filePath = StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesBadBehaviorPrefix + "/enterprisesBadBehaviorApprove";
    }
    
    /**
     * @Title: enterprisesBadBehaviorApprove
     * @Description: 企业不良行为审批接口
     * @Author wtj
     * @DateTime 2020年6月19日 下午6:05:34
     * @param cwie
     * @param reasonContent
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:ysbapprovalxw")
    @PostMapping("/enterprisesBadBehaviorApprove")
    @ResponseBody
    public AjaxResult enterprisesBadBehaviorApprove(@Validated CompanyPoorInfoEntuty cpie,String reasonContent)
    {
    	return toAjax(integrityInformationAddService.enterprisesBadBehaviorApprove(cpie, reasonContent));
    }
    
    //下面是撤销功能接口
    /**
     * @Title: enterprisesGoodBehaviorUndoAdd
     * @Description: 跳转到企业良好行为撤销申请页面
     * @Author wtj
     * @DateTime 2020年6月24日 下午5:09:52
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:passcx")
    @GetMapping("/enterprisesGoodBehaviorUndoAdd/{guid}")
    public String enterprisesGoodBehaviorUndoAdd(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyWellInfoEntity().getBehaviorCode());
    	applyInfo.getCompanyWellInfoEntity().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyWellInfoEntity", applyInfo.getCompanyWellInfoEntity());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	if(StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[2]);
    		String filePath = StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesGoodBehaviorPrefix + "/enterprisesGoodBehaviorUndo";
    }
    
    /**
     * @Title: enterprisesGoodBehaviorUndoSaveAndReport
     * @Description: 企业良好行为撤销申请的保存，上报
     * @Author wtj
     * @DateTime 2020年6月24日 下午5:10:28
     * @param cwie
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:passcx")
    @PostMapping("/enterprisesGoodBehaviorUndoSaveAndReport")
    @ResponseBody
    public AjaxResult enterprisesGoodBehaviorUndoSaveAndReport(@Validated CompanyWellInfoEntity cwie)
    {
    	if(StringUtils.isEmpty(cwie.getGuid()) || StringUtils.isEmpty(cwie.getIGMIntegrityApplyInfoGuid())) {
    		throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
    	}
    	return toAjax(integrityInformationAddService.enterprisesGoodBehaviorUndoSaveAndReport(cwie));
    }
    
    /**
     * @Title: editEnterprisesGoodBehaviorUndo
     * @Description: 跳转到企业良好行为撤销申请的编辑页面
     * @Author wtj
     * @DateTime 2020年6月24日 下午5:11:01
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:wsbeditcx")
    @GetMapping("/editEnterprisesGoodBehaviorUndo/{guid}")
    public String editEnterprisesGoodBehaviorUndo(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyWellInfoEntity().getBehaviorCode());
    	applyInfo.getCompanyWellInfoEntity().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyWellInfoEntity", applyInfo.getCompanyWellInfoEntity());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	if(StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[2]);
    		String filePath = StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesGoodBehaviorPrefix + "/enterprisesGoodBehaviorUndoUpdate";
    }
    
    /**
     * @Title: enterprisesGoodBehaviorUndoSaveAndReportUpdate
     * @Description: 企业良好行为撤销申请编辑保存接口
     * @Author wtj
     * @DateTime 2020年6月24日 下午5:51:40
     * @param cwie
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:wsbeditcx")
    @PostMapping("/enterprisesGoodBehaviorUndoSaveAndReportUpdate")
    @ResponseBody
    public AjaxResult enterprisesGoodBehaviorUndoSaveAndReportUpdate(@Validated CompanyWellInfoEntity cwie)
    {
    	if(StringUtils.isEmpty(cwie.getGuid()) || StringUtils.isEmpty(cwie.getIGMIntegrityApplyInfoGuid())) {
    		throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
    	}
    	return toAjax(integrityInformationAddService.enterprisesGoodBehaviorUndoSaveAndReportUpdate(cwie));
    }
    
    /**
     * @Title: enterprisesGoodBehaviorUndoApprove
     * @Description: 跳转到企业良好行为撤销审批页面
     * @Author wtj
     * @DateTime 2020年6月24日 下午5:52:32
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:ysbapprovalcx")
    @GetMapping("/enterprisesGoodBehaviorUndoApprove/{guid}")
    public String enterprisesGoodBehaviorUndoApprove(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyWellInfoEntity().getBehaviorCode());
    	applyInfo.getCompanyWellInfoEntity().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyWellInfoEntity", applyInfo.getCompanyWellInfoEntity());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	if(StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[2]);
    		String filePath = StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesGoodBehaviorPrefix + "/enterprisesGoodBehaviorUndoApprove";
    }
    
    /**
     * @Title: enterprisesGoodBehaviorUndoApprove
     * @Description: 企业良好行为撤销审批接口
     * @Author wtj
     * @DateTime 2020年6月28日 下午5:25:51
     * @param cwie
     * @param reasonContent
     * @return
     */
    @RequiresPermissions("iintegrityInformationAdd:enterprisesGoodBehavior:ysbapprovalcx")
    @PostMapping("/enterprisesGoodBehaviorUndoApprove")
    @ResponseBody
    public AjaxResult enterprisesGoodBehaviorUndoApprove(@Validated CompanyWellInfoEntity cwie,String reasonContent)
    {
    	if(cwie==null || StringUtils.isEmpty(cwie.getGuid()) || StringUtils.isEmpty(cwie.getIGMIntegrityApplyInfoGuid())) {
    		throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
    	}
    	return toAjax(integrityInformationAddService.enterprisesGoodBehaviorUndoApprove(cwie, reasonContent));
    }
    
    /**
     * @Title: enterprisesBadBehaviorUndoAdd
     * @Description: 跳转到企业不良行为撤销申请页面
     * @Author wtj
     * @DateTime 2020年6月28日 下午5:53:56
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:passcx")
    @GetMapping("/enterprisesBadBehaviorUndoAdd/{guid}")
    public String enterprisesBadBehaviorUndoAdd(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyPoorInfoEntuty().getBehaviorCode());
    	applyInfo.getCompanyPoorInfoEntuty().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyPoorInfoEntuty", applyInfo.getCompanyPoorInfoEntuty());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	if(StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[2]);
        	String filePath = StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesBadBehaviorPrefix + "/enterprisesBadBehaviorUndo";
    }
    
    /**
     * @Title: enterprisesBadBehaviorUndoSaveAndReport
     * @Description: 企业不良行为撤销申请的保存，上报
     * @Author wtj
     * @DateTime 2020年7月6日 下午3:04:27
     * @param cpie
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:passcx")
    @PostMapping("/enterprisesBadBehaviorUndoSaveAndReport")
    @ResponseBody
    public AjaxResult enterprisesBadBehaviorUndoSaveAndReport(@Validated CompanyPoorInfoEntuty cpie)
    {
    	if(StringUtils.isEmpty(cpie.getGuid()) || StringUtils.isEmpty(cpie.getIGMIntegrityApplyInfoGuid())) {
    		throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
    	}
    	return toAjax(integrityInformationAddService.enterprisesBadBehaviorUndoSaveAndReport(cpie));
    }
    
    /**
     * @Title: editEnterprisesBadBehaviorUndo
     * @Description: 跳转到企业不良行为撤销申请的编辑页面
     * @Author wtj
     * @DateTime 2020年7月6日 下午3:06:40
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:wsbeditcx")
    @GetMapping("/editEnterprisesBadBehaviorUndo/{guid}")
    public String editEnterprisesBadBehaviorUndo(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyPoorInfoEntuty().getBehaviorCode());
    	applyInfo.getCompanyPoorInfoEntuty().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyPoorInfoEntuty", applyInfo.getCompanyPoorInfoEntuty());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	if(StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[2]);
        	String filePath = StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesBadBehaviorPrefix + "/enterprisesBadBehaviorUndoUpdate";
    }
    
    /**
     * @Title: enterprisesBadBehaviorUndoSaveAndReportUpdate
     * @Description: 企业不良行为撤销申请编辑保存接口
     * @Author wtj
     * @DateTime 2020年7月6日 下午4:29:43
     * @param cpie
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:wsbeditcx")
    @PostMapping("/enterprisesBadBehaviorUndoSaveAndReportUpdate")
    @ResponseBody
    public AjaxResult enterprisesBadBehaviorUndoSaveAndReportUpdate(@Validated CompanyPoorInfoEntuty cpie)
    {
    	if(StringUtils.isEmpty(cpie.getGuid()) || StringUtils.isEmpty(cpie.getIGMIntegrityApplyInfoGuid())) {
    		throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
    	}
    	return toAjax(integrityInformationAddService.enterprisesBadBehaviorUndoSaveAndReportUpdate(cpie));
    }
    
    /**
     * @Title: enterprisesBadBehaviorUndoApprove
     * @Description: 跳转到企业不良行为撤销审批页面
     * @Author wtj
     * @DateTime 2020年7月6日 下午4:34:59
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:ysbapprovalcx")
    @GetMapping("/enterprisesBadBehaviorUndoApprove/{guid}")
    public String enterprisesBadBehaviorUndoApprove(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyPoorInfoEntuty().getBehaviorCode());
    	applyInfo.getCompanyPoorInfoEntuty().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyPoorInfoEntuty", applyInfo.getCompanyPoorInfoEntuty());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	if(StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[2]);
        	String filePath = StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesBadBehaviorPrefix + "/enterprisesBadBehaviorUndoApprove";
    }
    
    /**
     * @Title: enterprisesBadBehaviorUndoApprove
     * @Description: 企业不良行为撤销审批接口
     * @Author wtj
     * @DateTime 2020年7月6日 下午4:41:58
     * @param cpie
     * @param reasonContent
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:ysbapprovalcx")
    @PostMapping("/enterprisesBadBehaviorUndoApprove")
    @ResponseBody
    public AjaxResult enterprisesBadBehaviorUndoApprove(@Validated CompanyPoorInfoEntuty cpie,String reasonContent)
    {
    	if(cpie==null || StringUtils.isEmpty(cpie.getGuid()) || StringUtils.isEmpty(cpie.getIGMIntegrityApplyInfoGuid())) {
    		throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
    	}
    	return toAjax(integrityInformationAddService.enterprisesBadBehaviorUndoApprove(cpie, reasonContent));
    }
    
    //下面是整改
    /**
     * @Title: enterprisesGoodBehaviorRect
     * @Description: 跳到企业良好行为登记整改页面
     * @Author wtj
     * @DateTime 2020年7月16日 上午11:25:54
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesGoodBehavior:returnzgdj")
    @GetMapping("/enterprisesGoodBehaviorRect/{guid}")
    public String enterprisesGoodBehaviorRect(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyWellInfoEntity().getBehaviorCode());
    	applyInfo.getCompanyWellInfoEntity().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyWellInfoEntity", applyInfo.getCompanyWellInfoEntity());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	IGMAuditRecord igmar = integrityInformationAddService.selectIGMAuditRecordByGuidTopOne(applyInfo.getGuid());
    	mmap.put("igmar", igmar);
    	if(StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[2]);
    		String filePath = StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesGoodBehaviorPrefix + "/enterprisesGoodBehaviorRect";
    }
    
    /**
     * @Title: enterprisesGoodBehaviorUndoRect
     * @Description: 跳到企业良好行为撤销整改页面(未使用)
     * @Author wtj
     * @DateTime 2020年7月16日 下午3:07:29
     * @param guid
     * @param mmap
     * @return
     */
    @GetMapping("/enterprisesGoodBehaviorUndoRect/{guid}")
    public String enterprisesGoodBehaviorUndoRect(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyWellInfoEntity().getBehaviorCode());
    	applyInfo.getCompanyWellInfoEntity().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyWellInfoEntity", applyInfo.getCompanyWellInfoEntity());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	IGMAuditRecord igmar = integrityInformationAddService.selectIGMAuditRecordByGuidTopOne(applyInfo.getGuid());
    	mmap.put("igmar", igmar);
    	if(StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[2]);
    		String filePath = StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesGoodBehaviorPrefix + "/enterprisesGoodBehaviorUndoRect";
    }
    
    /**
     * @Title: enterprisesGoodBehaviorUndoSaveAndReportRect
     * @Description: 企业良好行为撤销整改保存（未使用）
     * @Author wtj
     * @DateTime 2020-9-28 15:04:52
     * @param cwie
     * @return
     */
    @PostMapping("/enterprisesGoodBehaviorUndoSaveAndReportRect")
    @ResponseBody
    public AjaxResult enterprisesGoodBehaviorUndoSaveAndReportRect(@Validated CompanyWellInfoEntity cwie)
    {
    	if(StringUtils.isEmpty(cwie.getGuid()) || StringUtils.isEmpty(cwie.getIGMIntegrityApplyInfoGuid())) {
    		throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
    	}
    	return toAjax(integrityInformationAddService.enterprisesGoodBehaviorRectSaveAndReport(cwie));
    }
    
    /**
     * @Title: enterprisesBadBehaviorRect
     * @Description: 跳到企业不良行为整改页面
     * @Author wtj
     * @DateTime 2020年7月16日 下午5:02:04
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions("integrityInformationAdd:enterprisesBadBehavior:returnzgdj")
    @GetMapping("/enterprisesBadBehaviorRect/{guid}")
    public String enterprisesBadBehaviorRect(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyPoorInfoEntuty().getBehaviorCode());
    	applyInfo.getCompanyPoorInfoEntuty().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyPoorInfoEntuty", applyInfo.getCompanyPoorInfoEntuty());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	IGMAuditRecord igmar = integrityInformationAddService.selectIGMAuditRecordByGuidTopOne(applyInfo.getGuid());
    	mmap.put("igmar", igmar);
    	if(StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[2]);
        	String filePath = StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
    	
		return enterprisesBadBehaviorPrefix + "/enterprisesBadBehaviorRect";
    }
    
    //下面是详情
    /**
     * @Title: detail
     * @Description: 企业良好行为的详情
     * @Author wtj
     * @DateTime 2020年7月16日 上午9:16:15
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions(value={"integrityInformationAdd:enterprisesGoodBehavior:ysbdetail", "integrityInformationAdd:enterprisesGoodBehavior:passdetai", "integrityInformationAdd:enterprisesGoodBehavior:returndetai"}, logical=Logical.OR)
    @GetMapping("/enterprisesGoodBehaviorDetail/{guid}")
    public String enterprisesGoodBehaviorDetail(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyWellInfoEntity().getBehaviorCode());
    	applyInfo.getCompanyWellInfoEntity().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyWellInfoEntity().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyWellInfoEntity", applyInfo.getCompanyWellInfoEntity());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	if("审核通过".equals(applyInfo.getState().trim()) || "审核退回".equals(applyInfo.getState().trim())) {
    		IGMAuditRecord igmar = integrityInformationAddService.selectIGMAuditRecordByGuidTopOne(applyInfo.getGuid());
        	mmap.put("igmar", igmar);
    	}
    	if(StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[2]);
    		String filePath = StrUtil.split(applyInfo.getCompanyWellInfoEntity().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesGoodBehaviorPrefix + "/enterprisesGoodBehaviorDetail";
    }
    
    /**
     * @Title: enterprisesBadBehaviorDetail
     * @Description: 企业不良行为的详情
     * @Author wtj
     * @DateTime 2020年7月21日 上午11:24:33
     * @param guid
     * @param mmap
     * @return
     */
    @RequiresPermissions(value={"integrityInformationAdd:enterprisesBadBehavior:ysbdetail", "integrityInformationAdd:enterprisesBadBehavior:passdetai", "integrityInformationAdd:enterprisesBadBehavior:returndetai"}, logical=Logical.OR)
    @GetMapping("/enterprisesBadBehaviorDetail/{guid}")
    public String enterprisesBadBehaviorDetail(@PathVariable("guid") String guid,ModelMap mmap)
    {
    	IGMIntegrityApplyInfo applyInfo = integrityInformationAddService.selectIGMIntegrityApplyInfoByGuid(guid);
    	if(applyInfo == null) {
			throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
		}
    	mmap.put("applyInfo", applyInfo);
    	StandardEntity se = integrityInformationAddService.selectStandardEntityByGuid(applyInfo.getCompanyPoorInfoEntuty().getBehaviorCode());
    	applyInfo.getCompanyPoorInfoEntuty().setStandard(se);
    	if(StrUtil.containsAny(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",")) {
    		String[] subStr=StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getStandard().getPenaltyScores(), ",");
    		mmap.put("subStr", subStr);
    	}
    	mmap.put("companyPoorInfoEntuty", applyInfo.getCompanyPoorInfoEntuty());
    	if(StringUtils.isEmpty(se.getMaxScores()) || se.getMaxScores().equals("0") || se.getMaxScores().equals("0.0")) {
    		se.setMaxScores("无上限");
    	}
    	mmap.put("StandardEntity", se);
    	if("审核通过".equals(applyInfo.getState().trim()) || "审核退回".equals(applyInfo.getState().trim())) {
    		IGMAuditRecord igmar = integrityInformationAddService.selectIGMAuditRecordByGuidTopOne(applyInfo.getGuid());
        	mmap.put("igmar", igmar);
    	}
    	if(StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|").length == 4) {
    		mmap.put("FileNameOld", StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[2]);
        	String filePath = StrUtil.split(applyInfo.getCompanyPoorInfoEntuty().getMaterials(), "|")[1];
        	String[] file = StrUtil.split(filePath, "/");
        	//判断是否属于陵水系统上传的文件
        	if(file.length >= 3) {
        		if("profile".equals(file[1]) && "lingshui".equals(file[2]) && StrUtil.containsAny(filePath, "/profile/lingshui/")) {
            		mmap.put("fileState", "1");
            		mmap.put("filePath", filePath);
            	}else {
            		mmap.put("fileState", "2");
            		mmap.put("filePath", "");
            	}
        	}else if(StrUtil.containsAny(filePath,"\\")){
        		if(StrUtil.split(filePath, "\\").length == 4) {
        			mmap.put("fileState", "0");
            		mmap.put("filePath", Global.getConfig("ruoyi.bigPlatform") + filePath);
        		}else {
        			mmap.put("fileState", "2");
            		mmap.put("filePath", "");
        		}
        	}
    	}else {
    		mmap.put("FileNameOld", "");
    		mmap.put("fileState", "2");
    		mmap.put("filePath", "");
    	}
		return enterprisesBadBehaviorPrefix + "/enterprisesBadBehaviorDetail";
    }
}
